<?php

use App\Http\Admin\Controllers\IndexController;
use App\Http\Admin\Controllers\LoginController;
use App\Http\Admin\controllers\System\AccountController;
use App\Http\Admin\Controllers\System\IconController;
use App\Http\Admin\Controllers\System\MenuController;
use App\Http\Admin\Controllers\System\UserCodesController;
use App\Http\Middleware\Authenticate;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
    return view('welcome');
});
// 首页
Route::controller(IndexController::class)->prefix('index')->group(function () {
    Route::get('/index', 'index')->name('index/index');
});
// 登录
Route::withoutMiddleware(Authenticate::class)->controller(LoginController::class)->prefix('login')->group(function () {
    Route::match(['get', 'post'], '/index', 'index')->name('login');
    Route::get('/getyzm', 'getyzm');
    Route::get('/logout', 'logout')->name('logout');
});
// 核心路由
Route::prefix('system')->group(function () {
    // 菜单管理
    Route::controller(MenuController::class)->prefix('menu')->group(function () {
        Route::get('/index', 'index')->name('system.menu/index');
        Route::get('/getData', 'getData');
        Route::get('/getDataAll', 'getDataAll');
        Route::match(['get', 'post'], '/add', 'add');
        Route::match(['get', 'post'], '/update', 'update');
        Route::get('/status', 'status');
        Route::get('/del', 'del');
    });
    // 管理员管理
    Route::controller(AccountController::class)->prefix('account')->group(function () {
        Route::get('/index', 'index')->name('system.account/index');
        Route::get('/getData', 'getData');
        Route::get('/getDataAll', 'getDataAll');
        Route::match(['get', 'post'], '/add', 'add');
        Route::match(['get', 'post'], '/update', 'update');
        Route::get('/status', 'status');
        Route::get('/del', 'del');
        Route::get('/resetPassword', 'resetPassword');
        Route::match(['get', 'post'], '/auth', 'auth');
        Route::get('/getAuthTreeData', 'getAuthTreeData');
        Route::match(['get', 'post'], '/changePassword', 'changePassword')->name('changePassword');
    });
    // 图标管理
    Route::controller(IconController::class)->prefix('icon')->group(function () {
        Route::get('/index', 'index')->name('system.icon/index');
        Route::get('/getData', 'getData');
        Route::match(['get', 'post'], '/add', 'add');
        Route::match(['get', 'post'], '/update', 'update');
        Route::get('/status', 'status');
        Route::get('/del', 'del');
    });
    // 短信验证码管理
    Route::controller(UserCodesController::class)->prefix('userCode')->group(function () {
        Route::get('/index', 'index')->name('system.userCode/index');
        Route::get('/getData', 'getData');
        Route::match(['get', 'post'], '/add', 'add');
        Route::match(['get', 'post'], '/update', 'update');
        Route::get('/status', 'status');
        Route::get('/del', 'del');
    });
});